//package com.base.api.exception;
//
//import com.base.api.result.CommonResult;
//import com.base.api.result.ResultCode;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.security.access.AccessDeniedException;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//
//
///**
// * 同一异常处理
// *
// * @author dengran
// * @since 2019/12/27
// */
//@ControllerAdvice
//@Slf4j
//public class BusExceptionHandle {
//
//    @ResponseBody
//    @ExceptionHandler(value = Exception.class)
//    public CommonResult handle(Exception e) {
//        if (e instanceof BusException) {
//            BusException busException = (BusException) e;
//            return CommonResult.failed(busException.getResultCode());
//        }else if (e instanceof AccessDeniedException) {
//            AccessDeniedException accessDeniedException = (AccessDeniedException) e;
//            return CommonResult.failed("没有权限，"+accessDeniedException.getMessage());
//        } else {
//            log.error("内部异常:e={},message={}", e, e.getMessage());
//            return CommonResult.failed(ResultCode.UNKNOWN_ERROR);
//        }
//    }
//}
